<template>
  <div class="search">
    <el-select v-model="type" @change="changeType" class="select">
      <el-option
        v-for="item in selectItems"
        :key="item.value"
        :lable="item.label"
        :value="item.value">
      </el-option>
    </el-select>
    <div class='search-input'>
      <el-input :placeholder="placeholderDes" v-model="searchValue"></el-input>
    </div>
    <el-button icon="el-icon-search" @click="search"></el-button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      searchValue: '',
      type: ''
    }
  },
  created () {
    this.type = this.initType
  },
  props: {
    selectItems: {
      type: Array,
      require: true
    },
    placeholderDes: {
      type: String,
      require: true
    },
    initType: {
      type: String,
      require: true
    }
  },
  methods: {
    changeType (newType) {
      this.$emit('changeType', newType)
    },
    search () {
      this.$emit('searchOk', this.searchValue)
    }
  }
}
</script>

<style lang="less" scoped>
.search {
  display: flex;
  .el-select {
    width: 90px;
    height: 40px;
    box-sizing: border-box;
    border-right: none;
    border-radius: 0;
    background-color: #DDF0FE;
    border: 1px solid #40b0ff;
  }
  .search-input {
    width: 216px;
    height: 40px;
    border: 1px solid #40b0ff;
    border-left: none;
    box-sizing: border-box;
    font-family: 'MicrosoftYaHei';
    font-size: 14px;
    color: #909399;
    border-radius: 0;
  }
  .el-button {
    width: 44px;
    height: 40px;
    padding: 0;
    border: 1px solid #40b0ff;
    border-radius: 0;
    color: #fff;
    background: #40b0ff;
    &:hover {
      background: #10b0ff
    }
  }
}
</style>